﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ERPEF.Model
{
    public class bs_model
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int model_id { get; set; } //产品编号
        public string model_model { get; set; } //自动生成编码
        public string model_name { get; set; }//产品名称
        public string? model_class { get; set; } //产品配料种类
        public string model_bulk_units { get; set; } //产品散装单位
        public decimal? model_bulk_price { get; set; }//产品散装单价
        public string model_wrap_units { get; set; } ////产品散装单位
        public decimal? model_wrap_price { get; set; }//产品包装单价
        public DateTime model_updated_date { get; set; }// 产品更新日期
        public bool? IsDeleted { get; set; } = false; //逻辑删除



        public List<bs_Model_From> bs_Model_Froms { get; set; } // 从表数据
        public virtual string ToString()
        {
            //return bs_Model_Froms.Count + " - " + bs_Model_Froms[0].model_from_name;
            if (bs_Model_Froms != null && bs_Model_Froms.Count > 0)
            {
                return bs_Model_Froms.Count + " - " + bs_Model_Froms[0].model_from_name;
            }
            else
            {
                return base.ToString(); // 或返回其他默认值  
            }
        }
    }
}
